<!-- 消息 -->
<template>
	<view>
		<!-- 搜索 -->
		<search-box :searchStatus="true" @search="search" @confirm="confirm" :cityName="city" :getcity="getcity">
		</search-box>
		<!-- 列表 -->
		<!-- #ifdef MP-WEIXIN -->
		<view style="height: 100rpx;"></view>
		<!-- #endif -->
		<view class="heighly">
			<zufang :list="dataList" :listHighly="highly"></zufang>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: '',
				getcity: [],
			};
		},
		async onLoad(e) {
			this.getcity = await this.require('getcity');
			this.city = this.getcity[0] ? this.getcity[0].name : '东莞市';
			let city = uni.getStorageSync('city');
			if (city) {
				this.city = city;
			}
			this.path = 'getHouselist';
			this.params = {
				...this.params,
				pnum: this.pnum,
				city: this.city,
				loupanleixing: '新房'
			};
			if (e.type != 1) delete this.params.loupanleixing;
			await this.getList();

		},
		methods: {
			async search(e) {
				this.dataList = [];
				this.params.p = 1;
				this.params.keywords = e || this.keyword;
				await this.getList();
			},
			async confirm(e) {
				this.city = this.params.city = e;
				uni.setStorageSync('city', this.city);
				this.params.p = 1;
				await this.getList();
			}
		}
	};
</script>

<style lang="scss" scoped>
	.search-ctn {
		background-color: #fff;
		position: fixed;
		z-index: 9999;
		width: 750rpx;
		padding: 20rpx;
		top: 0;
	}

	.search-box {
		background-color: #f6f6f6;
		border-radius: 50rpx;
		height: 60rpx;
		line-height: 60rpx;
		padding: 10rpx;
	}
</style>
